<?php

$num_columns	=4;
$can_delete	= $this->auth->has_permission('School.Schoolhouse.Delete');
$can_edit		= $this->auth->has_permission('School.Schoolhouse.Edit');
$has_records	= isset($records) && is_array($records) && count($records);

if ($can_delete) {
    $num_columns++;
}
?>
<style type="text/css">
  #TB_window {top: 20%; left: 60%; margin-left: 0px; overflow: hidden;}
</style>
<section>
	<div class='content-header'>
	<h1>
		<?php echo lang('hometop_area_title'); ?>
	</h1>
</section>
	

<section class="content">
  <div class="row">
    <div class="col-xs-12">
      <div class="box box-primary">
	   <?php echo form_open($this->uri->uri_string()); ?>
        <div class="box-header">
          <h3 class="box-title"><?php echo lang('hometop_area_title'); ?></h3>
          <div class="box-tools pull-right">
                <!-- <div class="pull-right" style="margin-bottom:10px"> -->
                	
                <a href="/<?php echo SITE_AREA . '/content/hometop/create'; ?>"  class="btn btn-block btn-primary">新增</a>
                <!-- </div> -->
          </div>
        </div>
        <div class="box-body">
          <table id="example2" class="table table-striped table-bordered table-hover">
			<thead>
				<tr>
					<?php if ($can_delete && $has_records) : ?>
					<th class='column-check'><input class='check-all' type='checkbox' /></th>
					<?php endif;?>
					
					<th>城市</th>
					<th>平台</th>
					<th>图片</th>
					<th>操作</th>
				</tr>
			</thead>
			<?php if ($has_records) : ?>

			<?php endif; ?>
			<tbody>
				<?php
				if ($has_records) :
					foreach ($records as $record) :
				?>
				<tr>
				<?php if ($can_delete) : ?>
					<td class='column-check'><input type='checkbox' name='checked[]' value='<?php echo $record->id; ?>' /></td>
				<?php endif;?>
					<td><?php e($record->city_name->area_name); ?></td>
					<td><?php e($record->imgtype == 1?'桌面端':'移动端'); ?></td>
                                                                      <td><img src="<?php echo $record->absolute_url; ?>" height="80px" /></td>
                                                        <?php if ($can_edit) : ?>
					<td>
						<a href="/<?php echo SITE_AREA . '/content/hometop/edit/' . $record->id; ?>" class="btn btn-xs btn-primary"><i class="fa fa-pencil" data-toggle="tooltip" data-placement="top" title="" data-original-title="Edit"></i></a>
						<a href="/<?php echo SITE_AREA . '/content/hometop/delete/' . $record->id; ?>" class="btn btn-xs btn-danger" style="cursor:pointer;" onclick="return confirm('确定删除吗?');"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="" data-original-title="Delete"></i></a>
					</td>
				<?php else : ?>
						<td></td>
				<?php endif; ?>
				</tr>
				<?php
					endforeach;
				else:
				?>
				<tr>
					<td colspan='<?php echo $num_columns; ?>'>暂时没有数据</td>
				</tr>
				<?php endif; ?>
			</tbody>
		</table>
	</div>
	<div class="box-footer">
		<div class="pull-left">
		选择之后：
		<button type="submit" name='delete' class="btn btn-danger" onclick="return confirm('确定删除吗?');"><?php echo lang('bf_action_delete'); ?></button>
		 </div>
	<div class="pull-right">
	        	<?php echo $this->pagination->create_links(); ?>
	</div>
		
	</div>
<?php
    echo form_close();
 ?>	       
      </div>
      <!-- /.box -->
    </div>
    <!-- /.col -->
  </div>

</section>